package wasnake.actors;

import java.awt.Color;
import wasnake.grid.Location;

/**
 * A basic structure for containing the contents of a single cell in the grid.
 * @author Mark
 */
public class Cell {
    /** The actor who owns this cell.*/
    private Actor owner;
    /** The color this cell will be painted.*/
    private Color color;
    /** The location of this cell in the grid.*/
    private Location location;
    
    /**
     * Creates a cell at the specified location using the color of the actor 
     * owning the cell.
     * @param owner The actor who owns this cell.
     * @param location The location of this cell in the grid.
     */
    public Cell(Actor owner, Location location) {
        this.owner = owner;
        this.location = location;
        this.color = owner.getColor();
    }
    
    /**
     * Gets the actor who owns this cell;
     * @return The owner of this cell;
     */
    public Actor getOwner() {
        return owner;
    }
    
    /**
     * Gets the color this cell will be painted.
     * @return The color of this cell.
     */
    public Color getColor() {
        return color;
    }
    
    /**
     * Gets the location of this cell in the grid.
     * @return The location of this cell.
     */
    public Location getLocation() {
        return location;
    }
    
    /**
     * Reset the color this cell will be painted.
     * @param newColor The new color of this cell.
     */
    public void setColor(Color newColor) {
        color = newColor;
    }
    
    /**
     * Reset the location of this cell in the grid.
     * @param newLocation The new location of this cell.
     */
    public void setLocation(Location newLocation) {
        location = newLocation;
    }
}
